/**
 * 用于设置APP基础配置的store
 *
 * mixWidth = 一级菜单的总宽度 + 顶部LOGO的宽度*2
 */
const app = {
    state: {
        sidebar: {
            opened: !+'',
            withoutAnimation: false
        },
        device: 'desktop',
        language: 'zh',
        mixHeight: 768,
        mixWidth: 1366,
        beforeRouteUpdateActive: false,

        basePath: '',
        dataPath: '',
        tempPath: '',
        userDownloadPath: '',
    },
    mutations: {
        SET_LANGUAGE: (state, language) => {
            state.language = language
        },
        SET_BEFOREROUTEUPDATEACTIVE: (state, beforeRouteUpdateActive) => {
            state.beforeRouteUpdateActive = beforeRouteUpdateActive
        },
        SET_BASEPATH: (state, basePath) => {
            state.basePath = basePath
        },
        SET_DATAPATH: (state, dataPath) => {
            state.dataPath = dataPath
        },
        SET_TEMPPATH: (state, tempPath) => {
            state.tempPath = tempPath
        },
        SET_USERDOWNLOADPATH: (state, userDownloadPath) => {
            state.userDownloadPath = userDownloadPath
        },
    },
    actions: {
        setLanguage({commit}, language) {
            commit('SET_LANGUAGE', language)
        },
        setBeforeRouteUpdateActive({commit}, beforeRouteUpdateActive) {
            commit('SET_BEFOREROUTEUPDATEACTIVE', beforeRouteUpdateActive)
        },
        setBasePath({commit}, basePath) {
            commit('SET_BASEPATH', basePath)
        },
        setDataPath({commit}, dataPath) {
            commit('SET_DATAPATH', dataPath)
        },
        setTempPath({commit}, tempPath) {
            commit('SET_TEMPPATH', tempPath)
        },
        setUserDownloadPath({commit}, userDownloadPath) {
            commit('SET_USERDOWNLOADPATH', userDownloadPath)
        },
    }
};

export default app
